% 
% @(#)Character.m	1.2  4/11/88
%
export _CharacterObject to "Builtins"

const _CharacterObject == immutable object _CharacterObject
  export getSignature, create, literal

  const CharacterType == immutable type CharacterType
    function ord -> [r : Integer]
    function > [o : Character] -> [r : Boolean]
      % r <- self > o
    function >= [o : Character] -> [r : Boolean]
      % r <- self >= o
    function < [o : Character] -> [r : Boolean]
      % r <- self < o
    function <= [o : Character] -> [r : Boolean]
      % r <- self <= o
    function = [o : Character] -> [r : Boolean]
      % r <- self = o
    function != [o : Character] -> [r : Boolean]
      % r <- self != o
    function asString -> [s : String]
      % s <- "c" where c is the character
  end CharacterType
  function getSignature -> [result : Signature]
    result <- CharacterType
  end getSignature
  function literal [x : Integer] -> [r : CharacterType]
    primitive 804 [r] <- [x]
  end literal
  function create -> [result : CharacterType]
    result <- immutable object aCharacter
      export >, >=, <, <=, =, !=, asString, ord
      function > [o : Character] -> [r : Boolean]
	primitive 004 [r] <- [o]
      end >
      function >= [o : Character] -> [r : Boolean]
	primitive 104 [r] <- [o]
      end >=
      function < [o : Character] -> [r : Boolean]
	primitive 204 [r] <- [o]
      end <
      function <= [o : Character] -> [r : Boolean]
	primitive 304 [r] <- [o]
      end <=
      function = [o : Character] -> [r : Boolean]
	primitive 404 [r] <- [o]
      end =
      function != [o : Character] -> [r : Boolean]
	primitive 504 [r] <- [o]
      end !=
      function asString -> [s : String]
	primitive 604 [s] <- []
      end asString
      function ord -> [r : Integer]
	primitive 704 [r] <- []
      end ord
    end aCharacter
  end create
end _CharacterObject
